local xionghuo = fk.CreateSkill{
  name = "ls__xionghuo",
  anim_type = "offensive",
  dynamic_desc = function(self, player)
    local mark = player:getTableMark("@ls__xionghuo")
    local current_num = "K"
    if #mark > 0 then
      current_num = mark[1]
    end
    return "ls__xionghuo_inner:"..current_num
  end,
}

Fk:loadTranslationTable{
  ["ls__xionghuo"] = "凶镬",
  [":ls__xionghuo"] = "出牌阶段，你可弃置一张伤害类牌或减1点体力上限，令一名此阶段未选择过的其他角色选择一项：" ..
  "交给你一张点数为A到<font color=\"#A95C68\">{K}</font>的牌，然后将<font color=\"#A95C68\">{}</font>中点数改为此牌点数；受到2点火焰伤害，然后将<font color=\"#A95C68\">{}</font>中点数改为K。",
  [":ls__xionghuo_inner"] = "出牌阶段，你可弃置一张伤害类牌或减1点体力上限，令一名此阶段未选择过的其他角色选择一项：" ..
  "交给你一张点数为A到<font color=\"#A95C68\">{1}</font>的牌，然后将<font color=\"#A95C68\">点数</font>改为此牌点数；受到2点火焰伤害，然后将<font color=\"#A95C68\">点数</font>改为K。",
  
  ["@ls__xionghuo"] = "凶镬：",
  ["#ls__xionghuo"] = "选择一张伤害类牌或不选（减1点体力上限），并选择一名角色",
  ["#xionghuo-discard"] = "凶镬：请弃置一张点数<font color=\"#E6E6FA\"><b>A~%arg</b></font>的牌",
  ["#xionghuo-give"] = "凶镬：请交给 %dest 一张点数<font color=\"#E6E6FA\"><b>A~%arg</b></font>的牌",
  ["$ls__xionghuo1"] = "鼎汇春秋，引江河入镬，升腾万古风流。",
  ["$ls__xionghuo2"] = "将者临战，执霜刃摧敌，醉邀袍泽分炙。",
}

xionghuo:addEffect("active", {
  anim_type = "offensive",
  prompt = "#ls__xionghuo",
  max_card_num = 1,
  min_target_num = 1,
  max_target_num = 1,
  can_use = Util.TrueFunc,
  card_filter = function(self, player, to_select, selected, selected_targets)
    return Fk:getCardById(to_select).is_damage_card
  end,
  target_filter = function(self, player, to_select, selected, selected_cards)
    if #selected == 0 and to_select ~= player then
      local xionghuoRecorded = player:getTableMark("ls__xionghuo_targets-phase")
      return not table.contains(xionghuoRecorded, to_select.id)
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    local mark = player:getTableMark("@ls__xionghuo")
    if #mark == 0 then mark = {"K"} end
    local xionghuoRecorded = player:getTableMark("ls__xionghuo_targets-phase")
    table.insertIfNeed(xionghuoRecorded, target.id)
    room:setPlayerMark(player, "ls__xionghuo_targets-phase", xionghuoRecorded)
    if #effect.cards > 0 then
      room:throwCard(effect.cards, xionghuo.name, player)
    else
      room:changeMaxHp(player, -1)
    end
    if not player.dead and not target.dead then
      local cards = room:askToCards(target, {
        min_num = 1,
        max_num = 1,
        skill_name = xionghuo.name,
        pattern = ".|A~"..mark[1],
        prompt = "#xionghuo-give::"..player.id..":"..mark[1],
        cancelable = true,
        include_equip = true,
      })
      if #cards == 0 then
        room:damage{
          from = player,
          to = target,
          damage = 2,
          damageType = fk.FireDamage,
          skillName = self.name,
        }
        mark = {"K"}
      else
        room:moveCardTo(cards, Player.Hand, player, fk.ReasonPrey, xionghuo.name, nil, true)
        mark = {Fk:getCardById(cards[1]):getNumberStr()}
      end
      room:setPlayerMark(player, "@ls__xionghuo", mark)
    end
  end,
})

return xionghuo